  
from  graphrag.config.load_config import load_config
from graphrag.api import global_search,basic_search
from pathlib import Path
PROJECT_DIRECTORY="./"
 
import pandas as pd
from graphrag.api import build_index,basic_search
 
from graphrag.index.typing.pipeline_run_result import PipelineRunResult

if __name__ == "__main__":
    import asyncio
    graphrag_config = load_config(Path(PROJECT_DIRECTORY))

    entities = pd.read_parquet(f"{PROJECT_DIRECTORY}/output/entities.parquet")
    communities = pd.read_parquet(f"{PROJECT_DIRECTORY}/output/communities.parquet")
    community_reports = pd.read_parquet(
    f"{PROJECT_DIRECTORY}/output/community_reports.parquet"
    )

    response, context = asyncio.run( global_search(
    config=graphrag_config,
    entities=entities,
    communities=communities,
    community_reports=community_reports,
    community_level=2,
    dynamic_community_selection=False,
    response_type="Multiple Paragraphs",
    query="Where did she go in the end?",
    ))
    print(response)


